package com.zretc.blog.service;

import com.zretc.api.pojo.Bookmark;
import com.zretc.blog.dao.BookmarkMapper;
import com.zretc.common.entity.RespResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;

@Service
@Transactional(rollbackFor = Exception.class)
public class BookmarkService {
    @Autowired
    BookmarkMapper bookmarkMapper;
    public RespResult addBookmark(Bookmark bookmark){
        bookmarkMapper.addBookmark(bookmark);
        RespResult r = new RespResult();
        return r;
    }
    public ArrayList<Bookmark> getBookmarkByUser(Integer userId){
        ArrayList<Bookmark> list = bookmarkMapper.getBookmarkByUser(userId);
        return list;
    }
    public void deleteBookmark(Bookmark bookmark){
        bookmarkMapper.deleteBookmark(bookmark);
    }

}
